import java.util.Scanner;

/**
 * Created by JiaJia on 2019/3/30 0030.
 */
public class HexConvert {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()){
            String str=sc.nextLine();
            System.out.println(Integer.parseInt(str,16));
        }

    }



}